package com.gsnd.briuppts.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.gsnd.briuppts.entity.Do.ManagerHurdlesExt;
import com.gsnd.briuppts.mapper.ManagerHurdlesExtMapper;
import com.gsnd.briuppts.mapper.ManagerHurdlesMapper;
import com.gsnd.briuppts.service.HurdlesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class HurdlesServiceImpl implements HurdlesService {
    @Autowired
    ManagerHurdlesMapper managerHurdlesMapper;
    @Autowired
    ManagerHurdlesExtMapper managerHurdlesExtMapper;
    @Override
    public List<Integer> findAllMax() {
        return managerHurdlesMapper.selectAllMax();
    }

    @Override
    public PageInfo<ManagerHurdlesExt>
    findByPage(Integer pageNum, Integer pageSize,
               String hName, Integer hMax,
               String fhName, String hEnable) {
        PageHelper.startPage(pageNum,pageSize);
        List<ManagerHurdlesExt> list =
                managerHurdlesExtMapper.selectHurdlesAndFenceHouse(hName, hMax, fhName, hEnable);
        PageInfo<ManagerHurdlesExt> pageInfo = new PageInfo<>(list);
        return pageInfo;
    }
}
